package routers

import (
	"github.com/astaxie/beego"
	"jujiu/web/controllers"
)

func Init() {
	beego.SetStaticPath("/", "static")
	mctr := &controllers.SynDataController{}
	dctr := &controllers.DispatchController{}
	rctr := &controllers.RomVerisonController{}
	qctr := &controllers.QueryController{}
	vctr := &controllers.VaryagController{}
	trctr := &controllers.TransTextController{}
	//beego.Router("/index", &controllers.MainController{})

	test := beego.NewNamespace("/api/v1/data/syn",
		beego.NSRouter("/real2dev", mctr, "get:Real2dev"),
		beego.NSRouter("/Hangzhou2Frankfurt", mctr, "get:Hangzhou2Frankfurt"),
	)

	dispatch := beego.NewNamespace("/api/v1/dispatch",
		beego.NSRouter("/common", dctr, "post:CommonDispatch"),
		beego.NSRouter("/cn2dev", dctr, "get:CNReal2CNdev"),
		beego.NSRouter("/cn2eu", dctr, "get:CNReal2EUReal"),
		beego.NSRouter("/eu2cn", dctr, "get:EUReal2CNReal"),
		beego.NSRouter("/dev2cn", dctr, "get:CNDev2CNReal"),
	)

	romversion := beego.NewNamespace("/api/v1/romversion",
		beego.NSRouter("/delete", rctr, "get:DeleteRomVersion"))

	query := beego.NewNamespace("/api/v1/query",
		beego.NSRouter("/device", qctr, "get:QueryDevice"))

	varyag := beego.NewNamespace("varyag/api/v1",
		beego.NSRouter("/cluster/info", vctr, "get:ClusterInfo"),
		beego.NSRouter("/node/session/num", vctr, "Get:NodeSessionNum"))

	transf := beego.NewNamespace("/api/v1/trasfer",
		beego.NSRouter("/syn", trctr, "get:TriggerTrans"))

	beego.AddNamespace(varyag)
	beego.AddNamespace(test)
	beego.AddNamespace(dispatch)
	beego.AddNamespace(romversion)
	beego.AddNamespace(query)
	beego.AddNamespace(transf)
}
